<!DOCTYPE html>
<html lang="en">
  <head>
    <title>TrueNAS Websocket Documentation</title>
    <!-- Latest compiled and minified CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    <!-- Optional theme -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
    <!-- Latest compiled and minified JavaScript -->
    <script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
    <style>
 body {
    overflow-x: hidden;
 }

/* Toggle Styles */

#wrapper {
    padding-left: 0;
    -webkit-transition: all 0.5s ease;
    -moz-transition: all 0.5s ease;
    -o-transition: all 0.5s ease;
    transition: all 0.5s ease;
}

#wrapper.toggled {
    padding-left: 250px;
}

#sidebar-wrapper {
    z-index: 1000;
    position: fixed;
    left: 250px;
    width: 0;
    height: 100%;
    margin-left: -250px;
    overflow-y: auto;
    background: #000;
    -webkit-transition: all 0.5s ease;
    -moz-transition: all 0.5s ease;
    -o-transition: all 0.5s ease;
    transition: all 0.5s ease;
}

#wrapper.toggled #sidebar-wrapper {
    width: 250px;
}

#page-content-wrapper {
    width: 100%;
    position: absolute;
    padding: 15px;
}

#wrapper.toggled #page-content-wrapper {
    position: absolute;
    margin-right: -250px;
}

/* Sidebar Styles */

.sidebar-nav {
    position: absolute;
    top: 0;
    width: 250px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.sidebar-nav li {
    text-indent: 20px;
    line-height: 40px;
}

.sidebar-nav li a {
    display: block;
    text-decoration: none;
    color: #999999;
}

.sidebar-nav li a:hover {
    text-decoration: none;
    color: #fff;
    background: rgba(255,255,255,0.2);
}

.sidebar-nav li a:active,
.sidebar-nav li a:focus {
    text-decoration: none;
}

.sidebar-nav > .sidebar-brand {
    height: 65px;
    font-size: 18px;
    line-height: 60px;
}

.sidebar-nav > .sidebar-brand a {
    color: #999999;
}

.sidebar-nav > .sidebar-brand a:hover {
    color: #fff;
    background: none;
}

@media(min-width:768px) {
    #wrapper {
        padding-left: 250px;
    }

    #wrapper.toggled {
        padding-left: 0;
    }

    #sidebar-wrapper {
        width: 250px;
    }

    #wrapper.toggled #sidebar-wrapper {
        width: 0;
    }

    #page-content-wrapper {
        padding: 20px;
        position: relative;
    }

    #wrapper.toggled #page-content-wrapper {
        position: relative;
        margin-right: 0;
    }
}

.tool_tip {
  position: relative;
  display: inline-block;
  border: 1px solid black;
  padding: 2px 4px;
  cursor: pointer;
}

.tool_tip .tooltip_text {
  visibility: hidden;
  width: 120px;
  background-color: black;
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 5px 0;
  position: absolute;
  z-index: 1;
  top: 150%;
  left: 50%;
  margin-left: -60px;
  width: 200px;
}

.tool_tip .tooltip_text::after {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  margin-left: -40px;
  border-width: 5px;
  border-style: solid;
  border-color: transparent transparent black transparent;
}

.tool_tip:hover .tooltip_text {
  visibility: visible;
}

    </style>
  </head>
  <body>

   <div id="wrapper">

        <!-- Sidebar -->
        <div id="sidebar-wrapper">
            <ul class="sidebar-nav">
                <li class="sidebar-brand">
                    <a href="#websocket_protocol">Websocket Protocol</a>
                </li>
                <li class="sidebar-brand">
                    <a href="#websocket_services">Websocket Services</a>
                </li>

                {% for service in services %}
                <li>
                  <a href="#{{ service.name }}">{{ service.name }}</a>
                </li>
                {% endfor %}

                <li class="sidebar-brand">
                    <a href="#websocket_events">Websocket Events</a>
                </li>
                <li class="sidebar-brand">
                    <a href="#jobs">Jobs</a>
                </li>
                <li class="sidebar-brand">
                    <a href="#query_methods">Query Methods</a>
                </li>
            </ul>
        </div>
        <!-- /#sidebar-wrapper -->

        <!-- Page Content -->
      <div id="page-content-wrapper">
        <div class="container-fluid">
           <div class="row">
             <div class="col-lg-12">

               <span id="websocket_protocol">
               {{ protocol|markdown|safe }}
               </span>

               <hr />

               <span id="websocket_services">
             {% for service in services %}
              <h2 id="{{ service.name }}">{{ service.name }}</h2>
              {% for mname, method in service.methods.items() %}
               <table class="table">
                 <thead>
                   <tr><th>
                       {{ mname }}
                       {% if method.job %}
                            <div class="tool_tip" style="margin-left: 20px;">Job
                                <span class="tooltip_text">
                                    This endpoint is a Job. Please refer to the <a href="#jobs">Jobs</a> section for details.
                                    {% if method.downloadable %}
                                    <br>
                                    A file can be downloaded from this endpoint. Please refer to the <a href="#jobs">Jobs</a> section to download a file.
                                    {% endif %}
                                    {% if method.uploadable %}
                                    <br>
                                    A file can be uploaded to this endpoint. Please refer to the <a href="#jobs">Jobs</a> section to upload a file.
                                    {% endif %}
                                </span>
                            </div>
                       {% endif %}
                   </th></tr>
                   {% if method.accepts %}
                   <tr><th>
                     Arguments:
                     <div>
                     {% for accept in method.accepts %}
                     <div style="float: left; margin-right: 10px;">
                       <div style="background-color: #ddd; white-space: pre; font-family: Courier;">{{ accept|json }}</div>
                     </div>
                     {% endfor %}
                     <div style="clear: both;"></div>
                     </div>
                   </th></tr>
                   {% endif %}
                   {% if method.returns %}
                   <tr><th>
                     Return Arguments:
                     <div>
                     {% for return_schema in method.returns %}
                     <div style="float: left; margin-right: 10px;">
                       <div style="background-color: #ddd; white-space: pre; font-family: Courier;">{{ return_schema|json }}</div>
                     </div>
                     {% endfor %}
                     <div style="clear: both;"></div>
                     </div>
                   </th></tr>
                   {% endif %}
                 </thead>
                 <tbody>
                   <tr><td>
                     {% if method.description %}
                       {{ method.description|markdown|safe }}
                     {% else %}
                       -
                     {% endif %}
                   </td></tr>
                   {% for example in method.examples.get('__all__', []) %}
                   <tr><td>{{ example|markdown|safe }}</td></tr>
                   {% endfor %}
                   {% for example in method.examples.get('websocket', []) %}
                   <tr><td>{{ example|markdown|safe }}</td></tr>
                   {% endfor %}
                 </tbody>
               </table>
              {% endfor %}
             {% endfor %}
               </span>

               <span id="websocket_events">
                {{ events|markdown|safe }}
               </span>

               <span id="jobs">
               {{ jobs|markdown|safe }}
               </span>

                 <span id="query_methods">
                 {{ query_filters|markdown|safe }}
                 </span>

             </div>
           </div>
        </div>
      </div>
        <!-- /#page-content-wrapper -->

    </div>
    <!-- /#wrapper -->

  </body>
</html>
